<include file="Public:header" />
<div class="container main"> <include file="Public:left" />
  <div class="w790"> 
    <script>
  	function uploaded(path){
		$("#img_url").attr("src",'__PUBLIC__'+path);
		$("input[name='img_url']").val(path);
	}
	
	function del_img(){
		if(confirm('您确定要删除图片吗?')){
			var file=$("input[name='img_url']").val();
			$.post("{:U('delImgBypath')}",{'path':file},function(data){
				$("input[name='img_url']").val('');
				$("#img_url").attr('src','');
			});
		}else{
			return false;
		}
	}
	//删除图组图片
	function mdel_img(path){
		$('#img_list div img').each(function(index, element) {
			$.post("{:U('delImgBypath')}",{'path':path},function(data){
				if(data=='OK'){
					
					$('#img_list div').each(function(index, element) {
                        if($(this).attr('url')==path){
							$(this).remove();
						}
                    });
					
					$('#picmsg input').each(function(index, element) {
                        if($(this).val()==path){
							$(this).remove();
						}
                    });
				}
			});
		});
	}
	
	$(document).ready(function(e) {
        $("input[name='MsgType']").each(function(index, element) {
            $(this).click(function(e) {
                $('div.content').hide();
				$('div.content').eq(index).show();
            });
        });
    });
	
	function after(e){
	    $(e).parent().parent().parent().parent().parent('li').after($(e).parent().parent().parent().parent().parent('li').prev());
    }
    function append(e){
	    $(e).parent().parent().parent().parent().parent('li').next().after($(e).parent().parent().parent().parent().parent('li'));
    }
	function delnews(e){
		$(e).parent().parent().parent().parent().parent().remove();
	}
	function addnews(){
		var html = $('#copyHTML').html();
		$(html).appendTo('#replyList ul');
	}
  </script>
    <style>
  	#replyList ul li{margin-top:5px; background:#eee; padding:8px; width:860px;}
	.delnews{display:block; width:30px; font-size:20px; height:30px; border-radius:15px; background:#f00; color:#fff; line-height:30px; text-align:center;}
  </style>
  
  
  
  
   
     <div class="h"><a href="{:U('index')}" class="btn btn-info"><i class="glyphicon glyphicon-circle-arrow-left"></i> 返回关键词列表</a>
 
 </div>
  
  
    
    <form class="checkoutform form-horizontal" action="{:U('insert')}" method="post">
    <input type="hidden" name="id" value="{$info.id}"  />
    
    
    
    
    <div class="table_ container">
        <div class="setting_table">
          <div class="form-group">
            <label class="col-sm-2 control-label">关键词</label>
            <div class="col-sm-10">
              <input class="form-control" datatype="*" value="{$info.keyword}" name="keyword" type="text" placeholder="关键词">
            </div>
          </div>
    
    
    
    
    
    
    <div class="form-group">
            <label class="col-sm-2 control-label">回复类型</label>
            <div class="col-sm-10">
              <label class="checkbox-inline"> <input name="MsgType" type="radio" id="type_0" value="text" checked="checked" />
                文本</label>
              <label class="checkbox-inline"> <input type="radio" <eq name="info['MsgType']" value="news">checked="checked"</eq> name="MsgType" value="news" id="type_1" />
                图文</label>
                
                
                <label class="checkbox-inline"> <input type="radio" <eq name="info['MsgType']" value="image">checked="checked"</eq> name="MsgType" value="image" id="type_1" />
                图片</label>
                
            </div>
          </div>
    
    
    
    
    
     <div class="form-group">
            <label class="col-sm-2 control-label"></label>
            <div class="col-sm-10">
              <div class="content">
              <textarea class="form-control" name="content" cols="70" rows="5" id="content">{$info.content}</textarea>
            </div>
            
            
            
            
            
            
            
            
            <div <neq name="info['MsgType']" value="news">style="display:none;"</neq> class="content" id="replyList">
              <ul>
              <volist name="newsList" id="vo">
                <li>
                  <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>标题：
                        <input type="text" size="70" name="title[]" value="{$vo.title}" /></td>
                        <td rowspan="2"><textarea name="description[]" rows="5">{$vo.description}</textarea></td>
                      <td rowspan="2"><input type="hidden" name="img_url[]" value="{$vo.img_url}" />
                        <img src="<notempty name="vo['img_url']">{:getThumbPath($vo['img_url'])}
                        <else/>
                        __PUBLIC__/Admin/images/defaultimg.png
                        </notempty>
                        " onclick="showImgBox(this);" id="img_url" height="40" width="40" /></td>
                      <td rowspan="2"><a href="javascript:void(0);" onclick="after(this);">上</a><a href="javascript:void(0);" onclick="append(this);">下</a></td>
                      <td rowspan="2"><a class="delnews" href="javascript:void(0);" onclick="delnews(this);">×</a></td>
                    </tr>
                    <tr>
                      <td>链接：
                        <input type="text" name="link[]" value="{$vo.link}" size="70" /></td>
                    </tr>
                  </table>
                </li>
                </volist>
              </ul>
              <a href="javascript:;" onclick="addnews();" style="display:inline-block;" class="mybutton">添加</a></div>
                
            </div>
          </div>
    
    
    
    
    
    <div <neq name="info['MsgType']" value="image">style="display:none;"</neq> class="content">
              
              
              
              
              
              <div class="form-group">
      <label class="col-sm-2 control-label"></label>
      <div class="col-sm-10">
         <input name="img_url1" type="hidden" value="{$info.img_url}" /><img onclick="showImgBox(this);" src="<notempty name="info['img_url']">{:getThumbPath($info['img_url'])}<else/>__PUBLIC__/Admin/images/defaultimg.png</notempty>" id="img_url1" height="40" />
      </div>
   </div>
              
              
              
              
              
              
              
              
            </div>
    
    
   
    
    </div>
    </div>
    
    
    
    
   
      
      
      
      <div class="pages">
        <button type="submit" class="btn btn-success">保存</button>
      </div>
    </form>
  </div>
  <div class="clear"></div>
</div>
<ul id="copyHTML" style="display:none;">
              <li>
                  <table class="table table-bordered" width="100%" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td>标题：
                        <input type="text" size="70" name="title[]" /></td>
                        
                        <td rowspan="2"><textarea name="description[]" rows="5"></textarea></td>
                      <td rowspan="2"><input type="hidden" name="img_url[]" />
                        <img src="<notempty name="info['img_url']">{:getThumbPath($info['img_url'])}
                        <else/>
                        __PUBLIC__/Admin/images/defaultimg.png
                        </notempty>
                        " onclick="showImgBox(this);" id="img_url" height="40" width="40" /></td>
                      <td rowspan="2"><a href="javascript:void(0);" onclick="after(this);">上</a><a href="javascript:void(0);" onclick="append(this);">下</a></td>
                      <td rowspan="2"><a class="delnews" href="javascript:void(0);" onclick="delnews(this);">×</a></td>
                    </tr>
                    <tr>
                      <td>链接：
                        <input type="text" name="link[]" size="70" /></td>
                    </tr>
                  </table>
                </li>
              </ul>
</body></html>